package com.manage.common.resultUtils;

import com.manage.common.enums.ResultEnum;

/**
 * @Create by ldr.
 * @create 2018-09-06 15:19
 * @Description：所有ajax请求返回类型,封装json结果
 */
public class JsonResult<T> {

    private int code;

    private String msg;

    private T data;

    public JsonResult(ResultEnum resultEnum, T data) {
        this(resultEnum);
        this.data = data;
    }

    public JsonResult(ResultEnum resultEnum) {
        this.code = resultEnum.getState();
        this.msg = resultEnum.getStateInfo();
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }
}
